import Vue from 'vue'
import Element from 'element-ui'
import VueI18n from 'vue-i18n'
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'

Vue.use(VueI18n)

const messages = {
  en: {
    title:'HuiHong',
    menu: {
        home:'Home',
        goods: 'Goods Manage',
        params: 'Params Manage',
        specifications:'Specifications',
        category:'Category Manage',
        order:'Orders Manage',
        orderList:'Order List',
        returned:'Returns Manage',
        user:'Users Manage'
    },
    lang:'Language',
    ...enLocale // 或者用 Object.assign({ message: 'hello' }, enLocale)
  },
  zh: {
    title:'惠宏管理系统',
    menu: {
        home:'首页',
        goods:'商品管理',
        params:'参数管理',
        specifications:'规格参数',
        category:'分类管理',
        order:'订单管理',
        orderList:'订单列表',
        returned:'退货管理',
        user:'用户管理'
    },
    lang:'语言',
    ...zhLocale // 或者用 Object.assign({ message: '你好' }, zhLocale)
  }
}
// Create VueI18n instance with options
const i18n = new VueI18n({
  locale: 'zh', // set locale
  messages, // set locale messages
})

Vue.use(Element, {
  i18n: (key, value) => i18n.t(key, value)
})

export default i18n